<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%-- 引入页面头 --%>
<%@ include file="/pageHead.jsp"%>
<form name="form1" id="form1" action="<%-- ${systemctx}/sample/saveSample.web --%>" method="post">
	<div class="pageMain">
		<div class="pageTitle">
		<%=MessageResourcesUtils.getMessage(request, "systemmanage.bascmanagement.title") %>
		<span></span>
		<%=MessageResourcesUtils.getMessage(request, "systemmanage.city.cityList.title") %>
		<span></span>
		<%=MessageResourcesUtils.getMessage(request, "systemmanage.city.cityList.list") %>
		</div>
		<div class="pageBody">
			<div class="form-group">
				<ul>
					<li>
						<i></i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.city.cityList.provincename") %></label>
						<span><input type="text" id="provincename" name="provincename" value="" /></span>
					</li>
				</ul>
				<ul>
					<li>
						<i></i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.city.cityList.openbankcitycode") %></label>
						<span><input type="text" id="citycode" name="citycode" value="" /></span>
					</li>
					<li>
						<i></i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.city.cityList.openbankcityname") %></label>
						<span><input type="text" id="cityname" name="cityname" value="" /></span>
					</li>
				</ul>	
			</div>	
		</div>
		<div class="button-group">
			<input type="hidden" id="provincecode" name="provincecode">
			<input type="button" class="btn btn-default" id="butQuery" name="butQuery" value="<%=MessageResourcesUtils.getMessage(request, "common.button.query") %>" />
			<input type="button" class="btn btn-default" onclick="cityAdd()" value="<%=MessageResourcesUtils.getMessage(request, "common.button.add") %>" />
		</div>
		<table width="100%">
			<tbody>
				<tr>
					<td>
						<table id="datagrid"></table>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</form>
<script type="text/javascript">
	$(document).ready(
			 
					function() {
						//加载分页控件 datagrid
						$('#datagrid').issdatagrid(
										{
											formid : 'form1',
											title : '<%=MessageResourcesUtils.getMessage(request, "systemmanage.city.cityList.openbankcitylist") %>',
											width : 'auto',
											nowrap : true,
											autoRowHeight : false,
											singleSelect : true,
											striped : true,
											//collapsible:true,
											url : '${systemctx}/systemmanage/city/queryCityListInfoDataGrid.json',
											sortName : 'modifytime',
											sortOrder : 'desc',
											remoteSort : true,
											idField : 'id',
											pagination : true,
											rownumbers : true,
											showFooter : true,
											queryParams:$('#form1').serializeObject(),
											columns : [ [{
												field : 'id',
												title : '<%=MessageResourcesUtils.getMessage(request, "common.button.operation") %>',
												width : 90,
												align : 'center',
												formatter : operate
											},{
												title : '<%=MessageResourcesUtils.getMessage(request, "systemmanage.city.cityList.openbankcitycode") %>',
												field : 'citycode',
												width : 100,
												sortable : true,
												align : 'left'
											}, {
												title : '<%=MessageResourcesUtils.getMessage(request, "systemmanage.city.cityList.openbankcityname") %>',
												field : 'cityname',
												width : 120,
												sortable : true,
												align : 'left'
											}, {
												title : '<%=MessageResourcesUtils.getMessage(request, "systemmanage.city.cityList.provincename") %>',
												field : 'provincename',
												width : 120,
												sortable : true,
												align : 'left'
											} ] ],
											onLoadSuccess : function(data) {

											}
										});

						$('#butQuery').click(
								function() {
									$('#datagrid').datagrid('load',
											$('#form1').serializeObject());
						});

						function operate(val, row) {
							return '<a href="javascript:void(0);" class="easyui-linkbutton" onclick="provinceUpdate('
									+ val
									+ ')"><%=MessageResourcesUtils.getMessage(request, "common.button.update") %></a> <a href="javascript:void(0);" class="easyui-linkbutton" onclick="cityDelete('
									+ val + ')"><%=MessageResourcesUtils.getMessage(request, "common.button.delete") %></a> ';
						}
						
						$("#provincename").issNewMagnifier({
							title: '<%=MessageResourcesUtils.getMessage(request, "systemmanage.province.provinceList.provincemagnifiertitle") %>',
							url: '${systemctx}/publicMagnifier/publicMagnifier.json',
							sortName : 'modifytime',
							sortOrder : 'desc',
							linkName: 'name',
							callSqlKey: 'queryProvinceMagnifierSql',
							columns:[[
										{title:'<%=MessageResourcesUtils.getMessage(request, "systemmanage.province.provinceList.openbankprovincecode")%>',field:'code',width:180,sortable:true,search:true,align:'left'},
										{title:'<%=MessageResourcesUtils.getMessage(request, "systemmanage.province.provinceList.openbankprovincename")%>',field:'name',width:300,search:true,sortable:true,align:'left',to:'provincename'},
										{field:'id',hidden:true}
									]],
							onBeforeOpen:function(p){
						      var queryParams = {
						    		  queryprovincename: '%' + $("#provincename").val() + '%',
						    		  statusid: <%=SysConstant.RecordStatus.VALID %>
						      };
						      return queryParams; 
						    }
						});

					});
	function cityAdd() {
		$(this).isswindow({
			title : '市信息-新增',
			noheader : true,
			url : '${systemctx}/systemmanage/city/toAddCity.web'
		});
	}
	
	function provinceUpdate(val) {
		var id = val;
		$(this).isswindow({
			title : '市信息-修改',
			noheader : true,
			url : '${systemctx}/systemmanage/city/toUpdateCity.web?id=' + id
		});
	}
	
	function cityDelete(val) {
		var id = val;
		if (confirm("<%=MessageResourcesUtils.getMessage(request, "alertinfo.common.jsp.alert2") %>")) {
			//正在执行...
			showSending();
			$.ajax({
				type : 'GET',
				url : '${systemctx}/systemmanage/city/deleteCity.json?id=' + id,
				dataType : 'json',
				success : function(data) {
					//关闭执行...
					closeSending();
					//显示AJAX请求后的提示信息
					$.fn.ajaxmessage(data);
					$('#datagrid').datagrid('reload',
							$('#form1').serializeObject());
					$('#datagrid').datagrid('clearSelections');
				}
			});
		}
	}
</script>
<%-- 引入页面尾 --%>
<%@ include file="/pageFloor.jsp"%>